Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

The A/D - D/A Example

Specifications for an A/D or D/A device will provide you with a voltage level that corresponds to "zero amplitude," and a voltage difference which, when added to or subtracted from the zero amplitude level, produces "full amplitude." The zero amplitude voltage level is typically 0V for DC-coupled outputs. The full amplitude voltage difference depends on the following:

Let's call these two parameters

    electrical_intercept == the "zero amplitude" voltage level
    electrical_slope == the "full amplitude" voltage difference

The specifications will return a numerical sample value corresponding to zero amplitude, and a numerical sample difference which, when added to or subtracted from the zero amplitude level, produces full amplitude. Currently, A/D and D/A devices most commonly represent audio with integers, where the numerical values are obvious. The zero amplitude value is usually taken as 0 for two's complement integers and (2^(nbits-1)) for unsigned integers. The full amplitude difference is usually assumed to be (2^(nbits-1))-1. Slightly different assignments, which account for the integer's non-symmetric range about 0, are also sometimes used.

Now let's call these two parameters:

    numerical_intercept == the "zero amplitude" numerical sample value
    numerical_slope == the "full amplitude" numerical sample difference

Using all four of these parameters, you can map any numerical value n onto the voltage v it produces (D/A) or represents (A/D) at the jack:

    v = electrical_intercept +
     electrical_slope * (n - numerical_intercept) / numerical_slope;

These four parameters work together to define a linear mapping between voltage and numerical sample values. In essence, they give meaning to the numbers in the computer. These parameters do not impose any constraints on the range or distribution of voltages at the jack or numerical values in the computer. For example:

If numerical_slope==32767 and numerical_intercept==0 , it may be entirely possible that the audio data contains no samples with value 32767. There may even be data that falls outside the range of -32767 to 32767.

To allay any future confusion: if you are familiar with existing floating point audio file formats, such as Berkeley/IRCAM/CARL, you may be familiar with the "maximum amplitude" tag they contain. This tag is not the same as the slope parameter defined here. This tag specifies the highest numerical absolute value of any sample in the file, which may not be the same as the numerical value which maps to full amplitude when played out an electrical jack.


© 1998 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |